﻿using Microsoft.AspNetCore.Mvc;
using PowerHub.MES.Common.Utility;
using PowerHub.MES.DTO.Crew.DTO;
using PowerHub.MES.DTO.Crew.QueryDto;
using PowerHub.MES.DTO.Shopfloor.DTO;
using PowerHub.MES.DTO.Shopfloor.QueryDTO;
using PowerHub.MES.Entities.BasicData;
using PowerHub.MES.Entities.Crew;
using PowerHub.MES.Entities.Shopfloor;
using PowerHub.MES.IServices.ICrew;
using PowerHub.MES.IServices.IShopfloor;
using PowerHub.MES.ReturnEntity;

namespace PowerHub.MES.Controllers.Crew
{
    /// <summary>
    /// 班组设置
    /// </summary>
    [ApiController]
    [Route("Api/MES/Crew/[controller]/[action]")]
    public class TeamBillController
    {

        private ICrew_TeamBillServices _Crew_TeamBillServices;

        public TeamBillController(ICrew_TeamBillServices TeamBillServices)
        {
            _Crew_TeamBillServices = TeamBillServices;
        }

        /// <summary>
        /// 获取班组设置列表
        /// </summary>
        /// <returns></returns>
        /// <exception cref="Exception"></exception>
        [HttpPost]
        [FunctionDescription("获取班组设置列表")]
        public async Task<OperationPageResult<List<Crew_TeamBill>>> GetCrew_TeamBillPageListAsync([FromBody] QueryCrew_TeamBillDTO pageQuery)
        {
            return await _Crew_TeamBillServices.GetCrew_TeamBillPageListAsync(pageQuery);
        }
        
        /// <summary>
        /// 获取班组设置明细列表
        /// </summary>
        /// <returns></returns>
        /// <exception cref="Exception"></exception>
        [HttpPost]
        [FunctionDescription("获取班组设置明细列表")]
        public async Task<OperationPageResult<List<BasicData_Userinfo>>> GetCrew_TeamBillDetialPageListAsync([FromBody] QueryCrew_TeamBillDetialDTO pageQuery)
        {
            return await _Crew_TeamBillServices.GetCrew_TeamBillDetialPageListAsync(pageQuery);
        }


        /// <summary>
        /// 批量删除班组设置
        /// </summary>
        /// <returns></returns>
        /// <exception cref="Exception"></exception>
        [HttpPost]
        [FunctionDescription("批量删除班组设置")]
        public async Task<OperationResult<object>> DeletionCrew_TeamBillAsync([FromBody] List<string> Query)
        {
            return await _Crew_TeamBillServices.DeletionCrew_TeamBillAsync(Query);
        }

        /// <summary>
        /// 更新班组设置
        /// </summary>
        /// <returns></returns>
        /// <exception cref="Exception"></exception>
        [HttpPost]
        [FunctionDescription("更新班组设置")]
        public async Task<OperationResult<object>> UpdateCrew_TeamBillAsync([FromBody] Crew_TeamBillDTO Query)
        {
            return await _Crew_TeamBillServices.UpdateCrew_TeamBillAsync(Query);
        }

        /// <summary>
        /// 添加班组设置
        /// </summary>
        /// <returns></returns>
        /// <exception cref="Exception"></exception>
        [HttpPost]
        [FunctionDescription("添加班组设置")]
        public async Task<OperationResult<object>> CreateCrew_TeamBillAsync([FromBody] Crew_TeamBillDTO Query)
        {
            return await _Crew_TeamBillServices.CreateCrew_TeamBillAsync(Query);
        }
    }
}
